package com.dianban.service.impl;


import com.dianban.dao.JwStoreDao;
import com.dianban.entity.JwStore;
import com.dianban.service.JwStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional(readOnly = true)
public class JwStoreServiceImpl implements JwStoreService {

    @Autowired
    private JwStoreDao jwStoreDao;

    @Override
    public List<JwStore> findList(String keyword) {
        return jwStoreDao.findList(keyword);
    }

    @Override
    public List<JwStore> findByUserId(Long userId) {
        return jwStoreDao.findByUserId(userId);
    }

    @Override
    @Transactional(readOnly = false)
    public void insert(JwStore jwStore) {
        jwStore.setCreatetime(System.currentTimeMillis()/1000);
        jwStoreDao.insert(jwStore);
    }

    @Override
    public JwStore findById(Long id) {
        return jwStoreDao.findById(id);
    }

    @Override
    public List<JwStore> findListByType(String keyword, String type) {
        return jwStoreDao.findListByType(keyword, type);
    }

}
